package books.ThinkingInJava.src.Chapter12;

import java.io.IOException;

public class ExceptionChain {
    public static void main(String[] args) {
        try {
            new ExceptionChain().b();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void a() throws IOException {
        throw new IOException();
    }

    public void b() throws Exception {
        try {
            a();
        } catch (IOException ie) {
            Exception e = new Exception(ie);
            throw e;
        }
    }

    public void c() {
        try {
            b();
        } catch (Exception ie) {
//            Exception e =  new Exception(ie);
//            e.initCause(ie);
            throw new RuntimeException(ie);
        }
    }
}
